<template>
  <simple-table :columns="r1ColumnData" :datas="r1data" @item-click="itemClick" @next-page="r1ScrollEvent"/>
</template>

<script setup>
import {reactive, ref} from "vue";
import {r1ColumnData} from "@/pages/attend-house/data";
import {nextPageFun, scrollNextEvent} from "@/common/tool";
import {BjgjApi} from "@/common/customs/overview";
import SimpleTable from "@/components/customs/simple-table/index.vue";
import {inject, onMounted} from "@vue/runtime-core";

const r1data = ref([]);
const onPlayCamera = inject("playCamera");
const r1Config = reactive({
  total: 0,
  isEnd: false,
  loading: false,
  params: {
    page: 1,
    page_size: 30
  }
});
const getR1 = async (next = false) => {
  const api = new BjgjApi();
  await nextPageFun(api, r1data, next, r1Config);
};
const r1ScrollEvent = (event) => {
  scrollNextEvent(event, r1Config, () => getR1(true));
};
const itemClick = (item) => {
  // console.log(item);
  onPlayCamera(item.cameraIndexCode);
};
onMounted(() => {
  getR1(false);
});
</script>

<style scoped>

</style>
